home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / win / csh_doc.zip / CONTDEMO.CSH next >
Text File  |  1994-03-15  |  4KB  |  110 lines

  1. set hamilton = `whereis csh.exe`:h:h
  2. while (1)
  3. cls
  4. echo 'Welcome to the Hamilton C shell demo!'
  5. echo
  6. echo
  7. echo 1 D% ^# First, go to the Hamilton C shell directory...
  8. echo 2 D% cd +c $hamilton
  9. cd +c $hamilton
  10. sleep
  11. echo
  12. echo
  13. echo 3 D% ^# List the contents of the directory.  Notice how subdirectories
  14. echo 4 D% ^# are shown highlighted. The C shell makes extensive use of color
  15. echo 5 D% ^# all colors are completely user-customizable.
  16. echo 6 D% ls -l
  17. ls -l
  18. sleep 4
  19. echo 
  20. echo
  21. echo 7 D% ^# Now list the bin directory, showing all the utilities. Notice
  22. echo 8 D% ^# that all the usual favorites such as grep, fgrep, head, tail,
  23. echo 9 D% ^# etc., are included.
  24. echo 10 D% ls bin
  25. ls bin
  26. sleep 6
  27. echo
  28. echo
  29. echo 11 D% ^# Hamilton C shell has aliases.  Here^'s an alias for the more
  30. echo 12 D% ^# filter, starting it up in interactive mode ^(so it^'ll first
  31. echo 13 D% ^# clear the screen and stay around even if it^'s less than a
  32. echo 14 D% ^# screenful.^)
  33. echo 15 D% alias mi
  34. alias mi
  35. sleep 4
  36. echo
  37. echo
  38. echo 16 D% ^# Everything always has online help with the -h option.  Here
  39. echo 17 D% ^# we^'ll pipe the help for grep into head, which will print just
  40. echo 18 D% ^# the first 10 lines.
  41. echo '19 D% grep -h | head'
  42. grep -h | head
  43. sleep 1
  44. echo
  45. echo
  46. echo 20 D% ^# The C shell is a powerful scripting lanuguage. Here^'s an
  47. echo 21 D% ^# example, factoring a large number.  Notice that we can time
  48. echo 22 D% ^# any command to see how long it takes.
  49. echo 23 D% time factor 1234123412
  50. time factor 1234123412
  51. sleep 6
  52. echo
  53. echo
  54. echo 24 D% ^# factor is really a C shell script.  We can find it with the
  55. echo 25 D% ^# whereis command ...
  56. echo 26 D% whereis factor
  57. whereis factor
  58. sleep 6
  59. echo
  60. echo
  61.  
  62. set f = `whereis factor`
  63. if ($#f > 1) then
  64. echo 27 D% ^# Let^'s go browse factor.  Here we^'ll use the history facility
  65. echo 28 D% ^# to pick up the text of the previous command ^(the whereis
  66. echo 29 D% ^# factor^) by typing '!!'.  The backquotes around it are command
  67. echo 30 D% ^# substitution, meaning run the command and paste the output
  68. echo 31 D% ^# back on the command line as an argument to more, using the
  69. echo 32 D% ^# :0 operator to pick off just the first occurrence we found.
  70. echo 33 D% more ^`!!^`:0
  71. echo 'more `whereis factor`:0'
  72. more $f:0
  73. else
  74. echo 27 D% ^# Let^'s go browse factor.  Here we^'ll use the history facility
  75. echo 28 D% ^# to pick up the text of the previous command ^(the whereis
  76. echo 29 D% ^# factor^) by typing '!!'.  The backquotes around it are command
  77. echo 30 D% ^# substitution, meaning run the command and paste the output
  78. echo 31 D% ^# ^(the d:\hamilton\bin\factor.csh pathname^) back on the command
  79. echo 32 D% ^# line as an argument to more...
  80. echo 33 D% more ^`!!^`
  81. echo 'more `whereis factor`'
  82. more `whereis factor`
  83. endif
  84. echo 34 D% ^# Notice that Hamilton C shell has procedures, a genuine numeric
  85. echo 35 D% ^# for loop, built-in functions like floor and sqrt and procedures
  86. echo 36 D% ^# can even be recursive.  Not surprisingly, a lot of customers
  87. echo 37 D% ^# are using Hamilton C shell with thousands of lines of scripts.
  88. echo 38 D% ^# For example, Sybase uses it to run the build for SQL Server,
  89. echo 39 D% ^# Microsoft^'s languages group uses it to run nightly regression
  90. echo 40 D% ^# tests, etc.
  91. sleep 15
  92. echo
  93. echo
  94. @ S = char(driveno(SystemRoot) + code('A') - 1)
  95. echo 41 D% ^# Finally, the C shell has a lot of creature comforts such as
  96. echo 42 D% ^# filename and command completion, command line editing and
  97. echo 43 D% ^# advanced wildcarding.  Here we^'ll search the entire $S^: disk
  98. echo 44 D% ^# looking for all the DLL^'s whose names start with ^'d^' ...
  99. echo 45 D% "time ls -L $S^:\...\d*.dll"
  100. time ls -L $S^:\...\d*.dll
  101. sleep 8
  102. echo
  103. echo
  104. echo 46 D% ^# For folks coming from a UNIX background -- or anyone looking
  105. echo 47 D% ^# simply for a more powerful scripting or development environment,
  106. echo 48 D% ^# Hamilton C shell can be very attractive, offering instant
  107. echo 49 D% ^# productivity gains.
  108. sleep 15
  109. end
  110.